//
//  TabbarIconModel.swift
//  WriteToLocal
//
//  Created by 郑东喜 on 2017/3/2.
//  Copyright © 2017年 郑东喜. All rights reserved.
//  tabbar图标模型

import UIKit

class TabbarIconModel: NSObject {
    static let shared = TabbarIconModel()
    
    //图标
    var comfun:((_ _data:NSDictionary)->Void)?
    
    //第一个按钮图标
    var one_nor : String?
    
    //第一个按钮选中图标
    var two_nor : String?
    
    //第二个按钮图标
    var three_nor : String?
    
    //第二个按钮选中图标
    var four_nor : String?
    
    //第三个按钮图标
    var five_nor : String?
    
    //第三个按钮选中图标
    var one_sele : String?
    
    //第四个按钮图标
    var two_sele : String?
    
    //第四个按钮选中图标
    var three_sele : String?
    
    //第五个按钮图标
    var four_sele : String?
    
    //第五个按钮选中图标
    var five_sele : String?
    
    //uitabbar 背景图片
    var tabbarBgImgName : String?
    
    
    
    func getTabbarIcon(_com:@escaping (_ _data:NSDictionary)->Void) -> Void {
    
        comfun = _com

        
        let fileManager = FileManager.default
        let filePath:String = NSHomeDirectory() + "/Documents/bj/tabbarIcon.plist"
        let exist = fileManager.fileExists(atPath: filePath)
        print("\((#file as NSString).lastPathComponent):(\(#line))\n",exist)
        
        if exist == true {
            //判断文件路径是否为空
            let array = NSMutableArray.init(contentsOfFile: NSHomeDirectory() + "/Documents/bj/tabbarIcon.plist")!
            
            
            print("\((#file as NSString).lastPathComponent):(\(#line))\n",array[1])
            
            _com(array[1] as! NSDictionary)
        } else {
            
            print("\((#file as NSString).lastPathComponent):(\(#line))\n","配置文件不对")
            return
        }
        
        
        
    }
    
}
